<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.sql.*"%>
<%
	//1.read 
	request.setCharacterEncoding("UTF-8");
	Integer id=new Integer(request.getParameter("id"));
	String loginName = request.getParameter("loginName");
	String password = request.getParameter("password");

	Class.forName("com.mysql.jdbc.Driver");
	Connection conn = null;
	PreparedStatement pst = null;
	String url = "jdbc:mysql://localhost:3306/2012jb?useUnicode=true&characterEncoding=UTF-8";
	String userName = "root";
	String dbpwd = "123456";
	conn = DriverManager.getConnection(url, userName, dbpwd);
	String sql = "UPDATE USER SET LOGIN_NAME=?,PASSWORD=? WHERE ID=?";
	pst = conn.prepareStatement(sql);
	pst.setString(1, loginName);
	pst.setString(2, password);
	pst.setInt(3, id);
	if (pst.executeUpdate() == 1) {
		System.out.println("update user OK");
		response.sendRedirect("list.jsp");
	} else {
		System.out.println("update user error");

	}
	pst.close();
	conn.close();
%>
